package mysql

import "gorm.io/gorm"

type House struct {
	gorm.Model
	HouseName    string  `gorm:"type:varchar(100);not null;comment:房源名称"`
	HouseAddress string  `gorm:"type:varchar(100);not null;comment:房源地址"`
	HouseArea    int32   `gorm:"type:int;not null;comment:面积"`
	HousePrice   float64 `gorm:"type:float(10,2);not null;comment:价格"`
}

func (h *House) List() error {
	return db.Limit(1).Find(&h).Error
}

func (h *House) Dear(houseId int) error {
	return db.Where("id = ?", houseId).Limit(1).Find(&h).Error
}
